# -*- coding: utf-8 -*-
# @Time    : 2024/8/30 上午9:41
# @Author  : wb
# @Email   : wb@163.com
# @File    : task_page
# @Software: PyCharm

from time import sleep
from pages.wb_base_page import BasePage
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select


class TaskCountSearch(BasePage):
    url = '/crm'
    # 定位器
    '''获取选择部门下拉框元素'''
    department_locator = (By.CSS_SELECTOR, '#department')
    '''获取搜索按钮元素'''
    count_search = (By.CSS_SELECTOR, '#searchForm > ul > li:nth-child(4) > button')
    def select(self):
        '''点击选择部门下拉框'''
        department_select_element = self.driver.find_element(*self.department_locator)
        department_select_office = Select(department_select_element)
        # 点击选择第一个部门
        department_select_office.select_by_index(1)
    def search_btn(self):
        # 点击搜索
        self.driver.find_element(*self.count_search).click()
        sleep(3)
